/** * @license * Copyright (c) 2014, 2018, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ "use strict";define(["ojs/ojcore","jquery","jqueryui-amd/widget","jqueryui-amd/unique-id","jqueryui-amd/keycode","jqueryui-amd/focusable","jqueryui-amd/tabbable","ojs/ojmessaging","ojs/ojcustomelement"],function(t,e){function n(t,n){var i=function(){var t=e(this),i=t.data(c);if(null!=i)for(var o=0;o-1&&t.is("."+g))},t.Components.__getDefaultOptions=function(e){for(var n={},i=t.Components.getDefaultOptions(),o=e.length-1;o>=0;o--){var r=i[e[o]];void 0!==r&&(n=s(n,r,!0))}return n},t.Components.getComponentElementByNode=function(e){return function e(n,i){if(null==n)return null;var o=1===n.nodeType;var s=t.Composite&&!i?t.Composite.getContainingComposite(n):null;if(s)return s;if(o&&n.hasAttribute("data-oj-internal"))return n.parentNode instanceof Element&&n.parentNode.hasAttribute("data-oj-surrogate-id")?(n=document.querySelector("[data-oj-popup-"+n.id+"-parent]"),e(n,i)):e(n.parentNode,i);if(l(n))return n;if(o&&n.classList.contains("oj-component")){if(a(n=n.querySelector(".oj-component-initnode:not([data-oj-internal])")||n))return n}else if(o&&n.hasAttribute("data-oj-containerid"))return n=document.getElementById(n.getAttribute("data-oj-containerid")),e(n,i);return e(n.parentNode,i)}(e,!!(arguments.length>1&&arguments[1]))},t.Components.getSubIdByNode=function(e,n){return t.Components.callComponentMethod(e,"getSubIdByNode",n)},t.Components.getNodeBySubId=function(e,n){return t.Components.callComponentMethod(e,"getNodeBySubId",n)},t.Components.getComponentOption=function(e,n){if(!l(e))throw new Error("node is not a component element");return r(e)?e.getProperty?e.getProperty.call(e,n):void 0:t.Components.__GetWidgetConstructor(e)("option",n)},t.Components.setComponentOption=function(e,n,i){if(!l(e))throw new Error("node is not a component element");r(e)?e.setProperty&&e.setProperty.call(e,n,i):t.Components.__GetWidgetConstructor(e)("option",n,i)},t.Components.callComponentMethod=function(n,i,o){if(!l(n))throw new Error("node is not a component element");return r(n)?n[i]?n[i].apply(n,[].slice.call(arguments,2)):void 0:t.Components.__GetWidgetConstructor(n).apply(e(n),[].slice.call(arguments,1))},t.Components._OJ_CONTAINER_ATTR="data-oj-container";var u,c="oj-component-names",g="oj-component-initnode",h="oj-subtree-hidden",p="oj-pending-subtree-hidden";function d(t,e,n,i,o,s,r){var a=n,l=!1,u={};delete i[o],Object.defineProperty(i,o,{get:function(){if(l)return a;if(null!=t._settingNestedKey)return a;var n=s(r?r():o);return m([e,n,a],u)},set:function(e){a=e,null!=t._settingNestedKey?u[t._settingNestedKey]=!0:l=!0},enumerable:!0})}function _(t){if(1===t.length){var e=t[0];return e instanceof o?e.getCallback():null}for(var n=!1,i=0;i2?o=Array.prototype.slice.call(arguments,1):2==arguments.length&&("object"==typeof(o=arguments[1])||o instanceof Array||(o=[o])),null==(i=this.option(v+e))?e:t.Translations.applyParameters(i.toString(),o)},getNodeBySubId:function(t){return null!=t&&null!=t.subId||!this.element?null:this.element[0]},getSubIdByNode:function(t){return null},destroy:function(){if(this._IsCustomElement())throw new Error("destroy cannot be called on a custom element");this._trigger("destroy"),t.DomUtils.dispatchEvent(this.element[0],new CustomEvent("_ojDestroy")),this._super(),this._ReleaseResources(),this.element.removeClass(g),this.widget().removeClass("oj-disabled"),this._removeStateClasses(this.element),function(t,e){var n=t.data(c);if(n){var i=n.indexOf(e);i>=0&&(n.splice(i,1),0===n.length&&t.removeData(c))}}(this.element,this.widgetName),this._RestoreAttributes(),this._initialCmDomAttr?this.element.attr("contextmenu",this._initialCmDomAttr):this.element.removeAttr("contextmenu"),this._propertyContext=null},option:function(t,n){if(0===arguments.length)return e.widget.extend({},this.options);var i=arguments[0],o=i,s=null,r={};if("string"==typeof i){o={};var a=i.split(".");if(i=a.shift(),a.length){var l;s=a.join(".");try{arguments.length>1&&(this._settingNestedKey=s),l=o[i]=e.widget.extend({},this.options[i])}finally{this._settingNestedKey=null}for(var u=0;u0&&(h?this._internalSetOptions(p,r):this._setOptions(p,r)),this},_internalSetOptions:function(t,e){for(var n in t){var i=t[n],o=this.options[n];this.options[n]=i,this._optionChanged(n,i,o,e)}},_setOptions:function(t,e){for(var n in t){var i=t[n];this._setOption(n,i,e)}return this},_setOption:function(t,e,n){var i=this.options[t];if("disabled"===t)this.options[t]=e,this.widget().toggleClass("oj-disabled",!!e).attr("aria-disabled",e),e&&this._removeStateClasses(this.widget());else{try{var o=null==n?null:n.subkey;null!=o&&(this._settingNestedKey=o),this._super(t,e)}finally{this._settingNestedKey=null}"contextMenu"===t&&this._SetupContextMenu()}return this._optionChanged(t,e,i,n),this},_optionChanged:function(t,n,i,o){var s,r=null,a=!1,l=!1,u=null,c="external",g=null;o&&(r=o._context)&&(u=r.originalEvent,a=void 0===r.writeback?null!=u:r.writeback,l=r.readOnly,g=r.optionMetadata,s=r.extraData,r.internalSet&&(c="internal")),(g=g||{}).writeback=a?"shouldWrite":"shouldNotWrite",l&&(g.readOnly=!0);var h={option:t,previousValue:i,value:n,optionMetadata:g,updatedFrom:c},p=null==o?null:o.subkey;if(p){var d=p.split("."),_=i;d.forEach(function(t){_&&(_=_[t])});var m=o.subproperty;m.previousValue=_,h.subproperty=m}null!=s&&(h=e.extend({},s,h)),this._trigger("optionChange",u,h)},_SetupResources:function(){this._SetupContextMenu()},_ReleaseResources:function(){this._ReleaseContextMenu()},_trigger:function(t,e,n){return this._trigger2(t,e,n).proceed},_trigger2:function(t,n,i){if(i=i||{},this._IsCustomElement())return this._triggerCustomEvent(t,n,i);var o=this.options[t];return(n=e.Event(n,y)).type=(this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],this.element.trigger(n,i),{proceed:!(e.isFunction(o)&&!1===o.apply(this.element[0],[n].concat(i))||n.isDefaultPrevented()),event:n}},_triggerCustomEvent:function(n,i,o){var s,r,a,l={},u=this._getRootElement();if("optionChange"===n){var c=t.CustomElementBridge.getPropertyForAlias(u,o.option);if(!t.CustomElementBridge.isKnownProperty(u,c))return{proceed:!0,event:null};s=t.__AttributeUtils.propertyNameToChangeEventType(c);for(var g=Object.keys(o),h=0;h0)return n[0]}else if(this.options.contextMenu)return e(this.options.contextMenu).first()[0];return null},_NotifyContextMenuGesture:function(t,e,n){this._OpenContextMenu(e,n)},_OpenContextMenu:function(n,i,o,s,r){var a=this._GetContextMenu();if(a||(a=this._contextMenuGestureInit&&e(this._contextMenuGestureInit).is(":visible")?this._contextMenuGestureInit:this._GetDefaultContextMenu()),a){var l={mouse:{my:"start top",at:"start bottom",of:n,collision:"flipfit"},touch:{my:"start>40 center",at:"start bottom",of:n,collision:"flipfit"},keyboard:{my:"start top",at:"start bottom",of:"launcher",collision:"flipfit"}},u={launcher:this.element,position:l[i]},c={initialFocus:"menu"};if(o=r?e.extend(u,o,c):e.extend(!0,u,o,c),a.__openingContextMenu=!0,"OJ-MENU"===a.tagName)a.open(n,o,s);else{var g=t.Components.__GetWidgetConstructor(a,"ojMenu");(g&&g("instance")).open(n,o,s)}a.__openingContextMenu=!1}},_GetDefaultContextMenu:function(){return null},_removeStateClasses:function(t){t.removeClass("oj-hover oj-focus oj-focus-highlight oj-active"),t.find(".oj-hover").removeClass("oj-hover"),t.find(".oj-focus").removeClass("oj-focus"),t.find(".oj-focus-highlight").removeClass("oj-focus-highlight"),t.find(".oj-active").removeClass("oj-active")},_isRealMouseEvent:function(e){return!t.DomUtils.recentTouchEnd()},_AddHoverable:function(t){var n;e.isPlainObject(t)?n=t.element:(n=t,t={});var i=t.afterToggle||e.noop;n.on("mouseenter"+this.hoverableEventNamespace,this._hoverStartHandler.bind(this,i)).on("mouseleave"+this.hoverableEventNamespace,this._hoverAndActiveEndHandler.bind(this,"oj-hover",i))},_RemoveHoverable:function(t){t&&t.off(this.hoverableEventNamespace)},_AddActiveable:function(n){var i;e.isPlainObject(n)?i=n.element:(i=n,n={});var o=n.afterToggle||e.noop;t.DomUtils.isTouchSupported()&&i.on("touchstart"+this.activeableEventNamespace,this._activeStartHandler.bind(this,o)).on("touchend"+this.activeableEventNamespace+" touchcancel"+this.activeableEventNamespace,this._hoverAndActiveEndHandler.bind(this,"oj-active",o)),i.on("mousedown"+this.activeableEventNamespace,this._activeStartHandler.bind(this,o)).on("mouseup"+this.activeableEventNamespace,this._hoverAndActiveEndHandler.bind(this,"oj-active",o)).on("mouseenter"+this.activeableEventNamespace,this._activeStartHandler.bind(this,o)).on("mouseleave"+this.activeableEventNamespace,this._hoverAndActiveEndHandler.bind(this,"oj-active",o))},_RemoveActiveable:function(t){t&&(t.off(this.activeableEventNamespace),u=null)},_activeStartHandler:function(t,n){var i=e(n.currentTarget);("mouseenter"!==n.type||this._isTargetInActiveElement(n.currentTarget))&&(i.hasClass("oj-disabled")||"touchstart"!==n.type&&!this._isRealMouseEvent(n)||(i.addClass("oj-active"),t(n.type),"mousedown"===n.type&&(u=n.currentTarget,this.document.one("mouseup",function(){u=null}))))},_hoverStartHandler:function(t,n){var i=e(n.currentTarget);!i.hasClass("oj-disabled")&&this._isRealMouseEvent(n)&&(i.addClass("oj-hover"),t(n.type))},_hoverAndActiveEndHandler:function(t,n,i){("oj-active"!==t||"mouseleave"!==i.type||this._isTargetInActiveElement(i.currentTarget))&&(e(i.currentTarget).removeClass(t),n(i.type))},_isTargetInActiveElement:function(t){return u===t||null!=u&&e.contains(u,t)},_hoverable:function(){},_focusable:function(n){e.isPlainObject(n)||(n={element:n}),n.component=this,t.DomUtils.makeFocusable(n)},_UnregisterChildNode:function(t){if(t){e(t).off(this.eventNamespace);var n=this.bindings;n&&(this.bindings=e(n.not(t)))}},_GetReadingDirection:function(){return t.DomUtils.getReadingDirection()},_NotifyAttached:function(){this._propertyContext=null},_NotifyDetached:function(){this._propertyContext=null,this._removeStateClasses(this.widget())},_NotifyInitShown:function(){},_NotifyShown:function(){},_NotifyHidden:function(){},_IsEffectivelyDisabled:function(){return!(!this.options.disabled&&!this._ancestorDisabled)},__setAncestorComponentDisabled:function(t){this._ancestorDisabled=t},_getTranslationSectionLoader:function(){var n=[],i=this,o=0;this._traverseWidgetHierarchy(function(s){var r=0==o?i._GetTranslationsSectionName():s.widgetFullName;o++;var a=t.Translations.getComponentTranslations(r);null==a||e.isEmptyObject(a)||n.push(r)});var s=n.length;return s>0?function(){if(1==s)return t.Translations.getComponentTranslations(n[0]);for(var i={},o=s-1;o>=0;o--)e.widget.extend(i,t.Translations.getComponentTranslations(n[o]));return i}:null},_getDynamicPropertyContext:function(){if(!this._propertyContext){var e={};this._propertyContext=e;var n=this.element[0];e.containers=function(e){for(var n=[];e;){var i=e.getAttribute,o=i?i.call(e,t.Components._OJ_CONTAINER_ATTR):null;null!=o&&n.push(o),e=e.parentNode}return n}(n),e.element=n,e.isCustomElement=this._IsCustomElement()}return this._propertyContext},_setupDefaultOptions:function(t,n){var i=this.options,o=this._getTranslationSectionLoader(),s=n[E];null==o||void 0!==s&&!e.isPlainObject(s)||d(this,void 0,n[E],i,E,o),this._loadGlobalDefaultOptions(t,n)},_loadGlobalDefaultOptions:function(n,i){var o=this.options,s=[];this._traverseWidgetHierarchy(function(t){s.push(t.widgetName)}),t.Components.getDefaultOptions(),s.push("default");var r=t.Components.__getDefaultOptions(s);if(!e.isEmptyObject(r)){var a=this,l=function(){return a._getDynamicPropertyContext()};for(var u in r){var c=i[u];if(void 0===c||e.isPlainObject(c)){var g=r[u];if(g){var h=_(g);if(h)d(this,n[u],c,o,u,h,l);else{var p=[n[u]].concat(g);p.push(c),o[u]=m(p)}}}}}},_traverseWidgetHierarchy:function(t){for(var e=this.constructor.prototype;null!=e&&"oj"===e.namespace;)t(e),e=Object.getPrototypeOf(e)},_getRootElement:function(){return this.OuterWrapper||this.element[0]},_IsCustomElement:function(){return null!=t.BaseCustomElementBridge.getRegistered(this._getRootElement().tagName)},_FixRendererContext:function(e){if(this._IsCustomElement()){var n=t.CollectionUtils.copyInto({},e);return delete n.component,n.componentElement=this._getRootElement(),n}return e},_WrapCustomElementRenderer:function(t){return this._IsCustomElement()&&"function"==typeof t?function(e){var n=t(e);return n&&n.insert?n.insert:null}:t},__saveWritebackOptions:function(t){this._writebackOptions=t},_getWritebackOption:function(t){return!(!this._writebackOptions||!this._writebackOptions[t])},__handleSubtreeAttached:function(){this._IsCustomElement()||this._NotifyAttached()},__handleSubtreeDetached:function(){this._IsCustomElement()||this._NotifyDetached()},_VerifyConnectedForSetup:function(){return!1},__handleConnected:function(){this._NotifyAttached(),this.__delayConnectDisconnect(0)||this._SetupResources()},__handleDisconnected:function(){this.__delayConnectDisconnect(1)||this._ReleaseResources(),this._NotifyDetached()},__delayConnectDisconnect:function(t){if(!this._VerifyConnectedForSetup())return!1;if(void 0===this.connectedState){var e=this;Promise.resolve().then(function(){e.connectedState===t&&(0===t?e._SetupResources():e._ReleaseResources()),e.connectedState=void 0})}return this.connectedState=t,!0},__getFocusElement:function(){return this.GetFocusElement()},GetFocusElement:function(){return this.element[0]}}),delete e.fn.baseComponent,t.__registerWidget=function(t,n,i,o){if(e.widget(t,n,i),o){var s=t.split(".")[1];delete e.fn[s]}if("oj.oj"===t.substring(0,5)||"oj._oj"===t.substring(0,6)){var r,a=t.split("."),l=a[0],u=a[1],c=l+"-"+u;r="_"===u.substring(0,1)?"_"+l+"-"+u.substring(3):l+"-"+u.substring(2),e.expr.pseudos[r.toLowerCase()]=function(t){return!!e.data(t,c)}}};var E="translations",v=E+".";function C(){return!0}var y={isDefaultPrevented:function(){return!1},preventDefault:function(){this.isDefaultPrevented=C},stopPropagation:function(){this.isPropagationStopped=C},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=C}};t.ComponentMessaging=function(t){this.Init(t)},t.Object.createSubclass(t.ComponentMessaging,t.Object,"oj.ComponentMessaging"),t.ComponentMessaging._DISPLAY_TYPE={NONE:"none",NOTEWINDOW:"notewindow",PLACEHOLDER:"placeholder",INLINE:"inline"},t.ComponentMessaging._DISPLAY_TYPE_TO_CALLBACK={},t.ComponentMessaging.registerMessagingStrategy=function(e,n){e&&"function"==typeof n&&(t.ComponentMessaging._DISPLAY_TYPE_TO_CALLBACK[e]=n)},t.ComponentMessaging.prototype.Init=function(e){t.ComponentMessaging.superclass.Init.call(this),this._component=e,this._activated=!1,this._initializeMessagingStrategies()},t.ComponentMessaging.prototype.activate=function(n,i,o){var s=this;t.Assert.assertObject(o),this._launcher=n,this._contentElement=i,this._messagingContent=t.CollectionUtils.copyInto(this._messagingContent||{},o),this._isActive()?this._reactivate():(e.each(this._strategies,function(t,e){e.activate(s)}),this._activated=!0)},t.ComponentMessaging.prototype.update=function(n){t.Assert.assertObject(n),t.Assert.assertBoolean(this._activated),this._messagingContent=t.CollectionUtils.copyInto(this._messagingContent||{},n),this._activated&&e.each(this._strategies,function(t,e){e.shouldUpdate(n)&&e.update()})},t.ComponentMessaging.prototype.deactivate=function(){e.each(this._strategies,function(t,e){e.deactivate()}),this._activated=!1,this._component=null,this._launcher=null,this._contentElement=null,this._strategies={}},t.ComponentMessaging.prototype.close=function(){e.each(this._strategies,function(t,e){e.close()})},t.ComponentMessaging.prototype._createMessagingStrategy=function(e,n){return new(t.ComponentMessaging._DISPLAY_TYPE_TO_CALLBACK[e]||t.ComponentMessaging._DISPLAY_TYPE_TO_CALLBACK[t.ComponentMessaging._DISPLAY_TYPE.NONE])(n)},t.ComponentMessaging.prototype._getComponent=function(){return this._component||null},t.ComponentMessaging.prototype._getLauncher=function(){return this._launcher||null},t.ComponentMessaging.prototype._getContentElement=function(){return this._contentElement||null},t.ComponentMessaging.prototype._getMessagingContent=function(){return this._messagingContent||{}},t.ComponentMessaging.prototype._isActive=function(){return this._activated},t.ComponentMessaging.prototype._getResolvedMessagingDisplayOptions=function(){var n,i,o,s,r,a,l,u={},c=!1,g=this._component.options.placeholder,h=this._component.options.displayOptions||{},p={};for(s=Object.keys(h),a=0;a0&&(r[t.ComponentMessaging._DISPLAY_TYPE.NOTEWINDOW]=this._createMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.NOTEWINDOW,n)),o.length>0&&(r[t.ComponentMessaging._DISPLAY_TYPE.PLACEHOLDER]=this._createMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.PLACEHOLDER,o)),s.length>0&&(r[t.ComponentMessaging._DISPLAY_TYPE.INLINE]=this._createMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.INLINE,s)),r[t.ComponentMessaging._DISPLAY_TYPE.NONE]=this._createMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.NONE,i),this._strategies=r},t.ComponentMessaging.prototype._reactivate=function(){var n,i=this._getResolvedMessagingDisplayOptions(),o=this;e.each(i,function(e,i){e+="",n=o._strategies[e],i&&i.length>0?n?n&&n.reactivate(i):(n=o._createMessagingStrategy(e,i),o._strategies[e]=n,n.activate(o)):n&&t.ComponentMessaging._DISPLAY_TYPE.NONE!==e&&(n.deactivate(),delete o._strategies[e])})},t.MessagingStrategy=function(t){this.Init(t)},t.Object.createSubclass(t.MessagingStrategy,t.Object,"oj.MessagingStrategy"),t.MessagingStrategy.prototype.Init=function(e){t.Assert.assertArray(e),t.MessagingStrategy.superclass.Init.call(this),this._displayOptions=e},t.MessagingStrategy.prototype.activate=function(t){this._componentMessaging=t},t.MessagingStrategy.prototype.deactivate=function(){},t.MessagingStrategy.prototype.close=function(){},t.MessagingStrategy.prototype.reactivate=function(t){this.Init(t)},t.MessagingStrategy.prototype.shouldUpdate=function(t){return!0},t.MessagingStrategy.prototype.update=function(){},t.MessagingStrategy.prototype.GetLauncher=function(){return this._componentMessaging._getLauncher()},t.MessagingStrategy.prototype.GetContentElement=function(){return this._componentMessaging._getContentElement()},t.MessagingStrategy.prototype.GetComponent=function(){return this._componentMessaging._getComponent()},t.MessagingStrategy.prototype.GetMessages=function(){return this.GetValidityState().getMessages()},t.MessagingStrategy.prototype.GetMaxSeverity=function(){return this.GetValidityState().getMaxSeverity()},t.MessagingStrategy.prototype.GetConverterHint=function(){var t=[],e=this._getMessagingContent(),n=e&&e.converterHint;return n&&t.push(n),t},t.MessagingStrategy.prototype.GetValidatorHints=function(){var t=[],n=this._getMessagingContent(),i=n&&n.validatorHint||[];return e.each(i,function(e,n){t.push(n)}),t},t.MessagingStrategy.prototype.GetTitle=function(){var t=this._getMessagingContent();return t&&t.title||""},t.MessagingStrategy.prototype.GetValidityState=function(){var t=this._getMessagingContent();return t&&t.validityState||null},t.MessagingStrategy.prototype.HasMessages=function(){var t=this.GetMessages();return!!(t&&t.length>0)},t.MessagingStrategy.prototype.ShowMessages=function(){return-1!==this._displayOptions.indexOf("messages")},t.MessagingStrategy.prototype.ShowConverterHint=function(){return-1!==this._displayOptions.indexOf("converterHint")},t.MessagingStrategy.prototype.ShowValidatorHint=function(){return-1!==this._displayOptions.indexOf("validatorHint")},t.MessagingStrategy.prototype.ShowTitle=function(){return-1!==this._displayOptions.indexOf("title")},t.MessagingStrategy.prototype.IsInvalid=function(){return this.GetValidityState().isInvalid()},t.MessagingStrategy.prototype._getMessagingContent=function(){return this._componentMessaging?this._componentMessaging._getMessagingContent():{}},t.DefaultMessagingStrategy=function(t){this.Init(t)},t.ComponentMessaging.registerMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.NONE,t.DefaultMessagingStrategy),t.DefaultMessagingStrategy._SELECTOR_STATE_INVALID="oj-invalid",t.DefaultMessagingStrategy._SELECTOR_STATE_WARNING="oj-warning",t.Object.createSubclass(t.DefaultMessagingStrategy,t.MessagingStrategy,"oj.DefaultMessagingStrategy"),t.DefaultMessagingStrategy.prototype.update=function(){t.DefaultMessagingStrategy.superclass.update.call(this);var e=this.GetLauncher(),n=this.GetMaxSeverity(),i=[],o=[],s=!1,r=this.GetComponent().widget();e&&(this.IsInvalid()?(i.push(t.DefaultMessagingStrategy._SELECTOR_STATE_WARNING),o.push(t.DefaultMessagingStrategy._SELECTOR_STATE_INVALID),s=!0):this.HasMessages()&&n===t.Message.SEVERITY_LEVEL.WARNING?(i.push(t.DefaultMessagingStrategy._SELECTOR_STATE_INVALID),o.push(t.DefaultMessagingStrategy._SELECTOR_STATE_WARNING)):(i.push(t.DefaultMessagingStrategy._SELECTOR_STATE_INVALID),i.push(t.DefaultMessagingStrategy._SELECTOR_STATE_WARNING)),r.removeClass(i.join(" ")).addClass(o.join(" ")),this.GetContentElement().attr({"aria-invalid":s}))},t.DefaultMessagingStrategy.prototype.deactivate=function(){this.GetComponent().widget().removeClass(t.DefaultMessagingStrategy._SELECTOR_STATE_INVALID).removeClass(t.DefaultMessagingStrategy._SELECTOR_STATE_WARNING),this.GetContentElement().removeAttr("aria-invalid"),t.DefaultMessagingStrategy.superclass.deactivate.call(this)},t.PlaceholderMessagingStrategy=function(t){this.Init(t)},t.ComponentMessaging.registerMessagingStrategy(t.ComponentMessaging._DISPLAY_TYPE.PLACEHOLDER,t.PlaceholderMessagingStrategy),t.Object.createSubclass(t.PlaceholderMessagingStrategy,t.MessagingStrategy,"oj.PlaceholderMessagingStrategy"),t.PlaceholderMessagingStrategy.prototype.Init=function(e){t.PlaceholderMessagingStrategy.superclass.Init.call(this,e)},t.PlaceholderMessagingStrategy.prototype.activate=function(e){t.PlaceholderMessagingStrategy.superclass.activate.call(this,e),this._refreshPlaceholder()},t.PlaceholderMessagingStrategy.prototype.reactivate=function(e){t.PlaceholderMessagingStrategy.superclass.reactivate.call(this,e),this._refreshPlaceholder()},t.PlaceholderMessagingStrategy.prototype.shouldUpdate=function(t){return!(!t||void 0===t.converterHint)},t.PlaceholderMessagingStrategy.prototype.update=function(){t.PlaceholderMessagingStrategy.superclass.update.call(this),this._refreshPlaceholder()},t.PlaceholderMessagingStrategy.prototype._refreshPlaceholder=function(){var t,e,n=this.GetLauncher();if(this.ShowPlaceholderContent()&&n){t=(e=this.GetConverterHint()).length?e[0]:"";var i={internalMessagingSet:!0};this.GetComponent().option({placeholder:t},{_context:i})}},t.PlaceholderMessagingStrategy.prototype.ShowPlaceholderContent=function(){return this.ShowConverterHint()},t.ComponentValidity=function(t,e){this.Init(t,e)},t.ComponentValidity.isInvalid=function(e){return t.Message.getMaxSeverity(e)>=t.Message.SEVERITY_LEVEL.ERROR},t.Object.createSubclass(t.ComponentValidity,t.Object,"oj.ComponentValidity"),t.ComponentValidity.prototype.Init=function(e,n){t.ComponentValidity.superclass.Init.call(this),this._initialize(e,n)},t.ComponentValidity.prototype.isInvalid=function(){return this._invalid},t.ComponentValidity.prototype.getMessages=function(){return this._messages},t.ComponentValidity.prototype.getMaxSeverity=function(){return this._maxSeverity},t.ComponentValidity.prototype.update=function(t,e){this._initialize(t,e)},t.ComponentValidity.prototype._initialize=function(e,n){this._compValid=e,this._compMessages=n,this._messages=this._getImmediateMessages(),this._maxSeverity=t.Message.getMaxSeverity(this._messages),this._invalid=t.ComponentValidity.isInvalid(this._messages)},t.ComponentValidity.prototype._getImmediateMessages=function(){for(var e,n=this._compMessages||[],i=[],o=0;o1&&"translations"===t[0]},CreateComponent:function(n){var i=this._INNER_DOM_FUNCTION;if(this._WIDGET_ELEM=t.CustomElementBridge._getWidgetElement(n,i?i(n):this._EXTENSION._INNER_ELEM),this._WIDGET_ELEM!==n){for(var o=this._EXTENSION._GLOBAL_TRANSFER_ATTRS||[],s=0;s",t.DomUtils._HTML_END_TAG="",t.DomUtils._LEGAL_ELEMENTS={SPAN:1,B:1,I:1,EM:1,BR:1,HR:1,LI:1,OL:1,UL:1,P:1,TT:1,BIG:1,SMALL:1,PRE:1},t.DomUtils._LEGAL_ATTRIBUTES={class:1,style:1},t.DomUtils.isHTMLContent=function(e){return 0===e.indexOf(t.DomUtils._HTML_START_TAG)&&e.lastIndexOf(t.DomUtils._HTML_END_TAG)===e.length-7},t.DomUtils.cleanHtml=function(n){var i=e(document.createElement("span")).get(0);return i.innerHTML=n,n&&n.indexOf("<")>=0&&t.DomUtils._cleanElementHtml(i),i},t.DomUtils._cleanElementHtml=function(n){for(var i,o,s,r,a=n.childNodes,l=a.length-1;l>=0;){if((i=a.item(l))&&1===i.nodeType)if(t.DomUtils._LEGAL_ELEMENTS[i.nodeName]){for(r=(o=i.attributes).length-1;r>=0;r--)s=o[r],void 0!==e(i).attr(s.name)&&(t.DomUtils._LEGAL_ATTRIBUTES[s.name]||i.removeAttribute(s.nodeName));t.DomUtils._cleanElementHtml(i)}else i&&n.removeChild(i);l--}},t.DomUtils.isAncestor=function(t,e){for(var n=e.parentNode;n;){if(n==t)return!0;n=n.parentNode}return!1},t.DomUtils.isAncestorOrSelf=function(e,n){return n==e||t.DomUtils.isAncestor(e,n)},t.DomUtils.addResizeListener=function(n,i,o){var s=e(n),r=s.data(t.DomUtils._RESIZE_TRACKER_KEY);null==r&&(r=new t.DomUtils._ResizeTracker(n),s.data(t.DomUtils._RESIZE_TRACKER_KEY,r),r.start()),r.addListener(i,o)},t.DomUtils.removeResizeListener=function(n,i){var o=e(n),s=o.data(t.DomUtils._RESIZE_TRACKER_KEY);null!=s&&(s.removeListener(i),s.isEmpty()&&(s.stop(),o.removeData(t.DomUtils._RESIZE_TRACKER_KEY)))},t.DomUtils.fixResizeListeners=function(n){e(n).find(".oj-helper-detect-expansion").parent().each(function(n,i){var o=e(i).data(t.DomUtils._RESIZE_TRACKER_KEY);null!=o&&o.init(!0)})},t.DomUtils.isMetaKeyPressed=function(e){var n=t.AgentUtils.getAgentInfo();return t.AgentUtils.OS.MAC===n.os?e.metaKey:e.ctrlKey},t.DomUtils.dispatchEvent=function(t,e){var n="disabled",i=t[n];try{t[n]=!1,t.dispatchEvent(e)}finally{t[n]=i}},t.DomUtils._invokeAfterPaint=(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return window.setTimeout(t,0)}).bind(window),t.DomUtils._cancelInvokeAfterPaint=(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||function(t){return window.clearTimeout(t)}).bind(window),t.DomUtils._ResizeTracker=function(n){var i=e.Callbacks(),o=[],s=[],r=2,a=0,l=null,u=null,c=null,g=null,h=null,p=null,d=null;function _(t){var e=!1;if(null!=g.offsetParent){var n=g.offsetWidth,i=g.offsetHeight;u===n&&c===i||(a=r,f(n,i),e=!0,t&&m(!0))}return e}function m(e){var s=n.offsetWidth,r=n.offsetHeight;i.has()&&(e?(null!==l&&t.DomUtils._cancelInvokeAfterPaint(l),l=t.DomUtils._invokeAfterPaint(function(){l=null,i.fire(s,r)})):i.fire(s,r));for(var a=0;a=0?(s.splice(e,1),o.splice(e,1)[0].stop()):i.remove(t)},this.isEmpty=function(){return!i.has()&&0==s.length},this.start=function(){if(d=function(t){t.stopPropagation(),_(!0)||a>0&&null!=g.offsetParent&&(0==g.scrollLeft||0==g.scrollTop)&&(a--,f(u,c))}.bind(this),n.attachEvent)p=function(){m(!1)}.bind(this),n.attachEvent("onresize",p);else{var t=n.childNodes[0];(g=document.createElement("div")).className="oj-helper-detect-expansion";var e=document.createElement("div");g.appendChild(e),null!=t?n.insertBefore(g,t):n.appendChild(g),g.addEventListener("scroll",d,!1),(h=document.createElement("div")).className="oj-helper-detect-contraction";var i=document.createElement("div");i.style.width="200%",i.style.height="200%",h.appendChild(i),n.insertBefore(h,g),h.addEventListener("scroll",d,!1),this.init(!1)}},this.stop=function(){null!=l&&(t.DomUtils._cancelInvokeAfterPaint(l),l=null),null!=g?(g.removeEventListener("scroll",d),h.removeEventListener("scroll",d),g.parentNode&&n.removeChild(g),h.parentNode&&n.removeChild(h)):n.detachEvent("onresize",p)},this.init=function(t){var e=_(t);t&&!e&&null!=g.offsetParent&&f(u,c)}},t.DomUtils._RESIZE_TRACKER_KEY="_ojResizeTracker",t.DomUtils.isValidIdentifier=function(t){return/^[A-Za-z][0-9A-Z_a-z-]*$/.test(t)},t.DomUtils._collapsingListenerManager=function(t,e){var n=null,i=null,o=function(){t.apply(null,n),i=null},s=function(){n=Array.prototype.slice.call(arguments),null==i&&(i=window.setTimeout(o,e))};this.getCallback=function(){return s},this.stop=function(){null!=i&&(window.clearTimeout(i),i=null)}},t.DomUtils.isTouchSupported=function(){return"ontouchstart"in window||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints>0},t.DomUtils.setInKoCleanExternal=function(e){t.DomUtils._koCleanNode=e},t.DomUtils.unwrap=function(e,n){var i=t.DomUtils._koCleanNode;i&&e.get(0)===i||(n?n.replaceWith(e):e.unwrap())},t.DomUtils.isChromeEvent=function(n){function i(n){var i=n.target,o=e(i),s=i.getBoundingClientRect(),r=t.DomUtils.getScrollBarWidth(),a="ltr"===t.DomUtils.getReadingDirection();return!(!a||"HTML"!==i.nodeName&&"visible"===o.css("overflow-x")||!(n.clientX>s.right-r))||(!a&&"HTML"===i.nodeName&&n.clientX>s.left-r||(!a&&"visible"!==o.css("overflow-x")&&n.clientXs.bottom-r))}if(!("clientX"in n&&"clientY"in n))return!1;var o=t.AgentUtils.getAgentInfo();return t.AgentUtils.OS.ANDROID!==o.os&&t.AgentUtils.OS.IOS!==o.os&&(t.AgentUtils.ENGINE.GECKO===o.engine?function(t){try{return!t.originalTarget.localName}catch(t){return!0}}(n):t.AgentUtils.ENGINE.WEBKIT===o.engine||t.AgentUtils.ENGINE.BLINK===o.engine?i(n):t.AgentUtils.BROWSER.IE===o.browser&&function(t){return i(t)}(n))},t.DomUtils.getScrollBarWidth=function(){var n=t.DomUtils._scrollBarWidth;if(e.isNumeric(n))return n;var i=e("
");e(document.body).append(i),i.width(50).height(50).css({overflow:"scroll",visibility:"hidden",position:"absolute"});var o=e("
");o.height(1),i.append(o);var s=o.width(),r=i.width();return i.remove(),n=t.DomUtils._scrollBarWidth=r-s},t.DomUtils.getReadingDirection=function(){var t=document.documentElement.getAttribute("dir");return t&&(t=t.toLowerCase()),"rtl"===t?"rtl":"ltr"},t.DomUtils.getScrollLeft=function(e){if("rtl"===t.DomUtils.getReadingDirection()){var n=t.AgentUtils.getAgentInfo().browser;return n===t.AgentUtils.BROWSER.FIREFOX||n===t.AgentUtils.BROWSER.IE||n===t.AgentUtils.BROWSER.EDGE?Math.abs(e.scrollLeft):Math.max(0,e.scrollWidth-e.clientWidth-e.scrollLeft)}return e.scrollLeft},t.DomUtils.setScrollLeft=function(e,n){if("rtl"===t.DomUtils.getReadingDirection()){var i=t.AgentUtils.getAgentInfo().browser;i===t.AgentUtils.BROWSER.FIREFOX?e.scrollLeft=-n:i===t.AgentUtils.BROWSER.IE||i===t.AgentUtils.BROWSER.EDGE?e.scrollLeft=n:e.scrollLeft=Math.max(0,e.scrollWidth-e.clientWidth-n)}else e.scrollLeft=n},t.DomUtils.getCSSLengthAsInt=function(t){if(!isNaN(t))return parseInt(t,10);if(t&&t.length>0&&"auto"!=t){var e=parseInt(t,10);return isNaN(e)&&(e=0),e}return 0},t.DomUtils.getCSSLengthAsFloat=function(t){if(!isNaN(t))return parseFloat(t);if(t&&t.length>0){var e=parseFloat(t);return isNaN(e)&&(e=0),e}return 0},t.DomUtils._LOGICAL_PARENT_DATA="oj-logical-parent",t.DomUtils.getLogicalParent=function(e){if(e)return e.data(t.DomUtils._LOGICAL_PARENT_DATA)},t.DomUtils.setLogicalParent=function(e,n){e&&(null===n?e.removeData(t.DomUtils._LOGICAL_PARENT_DATA):e.data(t.DomUtils._LOGICAL_PARENT_DATA,n))},t.DomUtils.isLogicalAncestorOrSelf=function(n,i){t.Assert.assertDomElement(n),t.Assert.assertDomElement(i);for(var o=i;o;){if(o==n)return!0;var s=t.DomUtils.getLogicalParent(e(o));o=s?s[0]:o.parentNode}return!1},t.DomUtils.validateURL=function(t,e){var n=e||["http:","https:"],i=document.createElement("a");i.href=t;var o=i.protocol;if(null!=o&&(o=o.toLowerCase()),n.indexOf(o)<0)throw o+" is not a valid URL protocol"},t.DomUtils._supressNativeContextMenu=function(){e(document.body).hasClass("oj-hybrid")&&document.body.addEventListener("contextmenu",function(t){t.preventDefault()},!0)},t.DomUtils._supressNativeContextMenu(),t.DomUtils.PRESS_HOLD_THRESHOLD=750,t.DomUtils.recentTouchEnd=function(){var t=0;function e(){t=Date.now()}return document.addEventListener("touchend",e,!0),document.addEventListener("touchcancel",e,!0),function(){return Date.now()-t<500}}(),t.DomUtils.recentTouchStart=function(){var e=0,n=t.DomUtils.PRESS_HOLD_THRESHOLD+50;return document.addEventListener("touchstart",function(){e=Date.now()},!0),function(){return Date.now()-eS+t.DomUtils.PRESS_HOLD_THRESHOLD)&&(S=e,A=!1)},!0),document.addEventListener("touchstart",function(){S=Date.now(),A=!0},!0),document.addEventListener("mouseup",function(){S=Date.now(),A=!1},!0),document.addEventListener("touchend",function(){S=Date.now(),A=!1},!0),function(){return Date.now()-S<(A?T:600)}),t.DomUtils.makeFocusable=(D=0,P=(t.ThemeUtils.parseJSONFromFontFamily("oj-focus-config")||{}).focusHighlightPolicy,function(n){var i=n.element,o="ojFocusable";if(n.remove){i.removeClass("oj-focus oj-focus-highlight");var s=i.data(o);if(null==s)return;var r=".ojFocusable"+(""+s).split(",").join(" .ojFocusable");i.off(r).removeData(o)}else{var a=n.afterToggle||e.noop,l=n.applyHighlight?function(e){e.addClass("oj-focus"),function(e,n){switch(e?e():P){case"all":return!0;case"none":return!1;default:return!(t.DomUtils.recentPointer()||n&&n())}}(n.getFocusHighlightPolicy,n.recentPointer)&&e.addClass("oj-focus-highlight"),a("focusin")}:function(t){t.addClass("oj-focus"),a("focusin")};(n.setupHandlers||function(t,s){var r=n.component,a=function(n){t(e(n.currentTarget))},l=function(t){s(e(t.currentTarget))};if(r)r._on(i,{focusin:a,focusout:l});else{var u=D++,c=i.data(o);i.data(o,null==c?u:c+","+u);var g={},h=".ojFocusable"+u;g["focusin"+h]=a,g["focusout"+h]=l,i.on(g)}})(l,function(t){t.removeClass("oj-focus oj-focus-highlight"),a("focusout")})}}),t.FocusUtils={},t.FocusUtils._TABBABLE=":tabbable",t.FocusUtils.containsFocus=function(e){var n=document.activeElement;return!(!e||!n)&&t.DomUtils.isAncestorOrSelf(e,n)},t.FocusUtils.focusElement=function(t){t.focus()},t.FocusUtils.focusFirstTabStop=function(e){var n=t.FocusUtils.getFirstTabStop(e);return n&&t.FocusUtils.focusElement(n),n},t.FocusUtils.getFirstTabStop=function(n){var i=e(n);if(i.is(t.FocusUtils._TABBABLE))return n;var o=i.find(t.FocusUtils._TABBABLE);return o&&o.length>0?o[0]:null},t.FocusUtils.isFocusable=function(n){return!!e(n).is(":focusable")&&!("A"===n.nodeName&&!n.hasAttribute("tabindex")&&t.AgentUtils.getAgentInfo().browser===t.AgentUtils.BROWSER.SAFARI)},t.GestureUtils={},t.GestureUtils._EVENT_NAMESPACE=".contextMenu",t.GestureUtils.stopDetectContextMenuGesture=function(n){e(n).off(t.GestureUtils._EVENT_NAMESPACE).removeClass("oj-menu-context-menu-launcher")[0].removeEventListener("click",n._clickListener,!0),clearTimeout(n._contextMenuPressHoldTimer)},t.GestureUtils.startDetectContextMenuGesture=function(n,i){var o,s,r,a,l=t.DomUtils.PRESS_HOLD_THRESHOLD,u=!1,c=!1,g=null,h=t.GestureUtils._EVENT_NAMESPACE,p=!1,d=function(t,o,s){if((u=s)&&e(n).one("touchend"+h,function(t){p=!0,setTimeout(function(){p=!1},50)}),"touchstart"===g&&"contextmenu"===t.type||"contextmenu"===g&&"touchstart"===t.type)return g=null,void clearTimeout(a);t.isDefaultPrevented()||t.originalEvent&&t.originalEvent.defaultPrevented||(i(t,o),t.isDefaultPrevented()&&("touchstart"!==t.type&&"contextmenu"!==t.type||(g=t.type,a=setTimeout(function(){g=null},300))))},_=function(t){u&&(t.preventDefault(),t.stopPropagation(),u=!1)};n._clickListener=_,n.addEventListener("click",_,!0),e(n).on("touchstart"+h+" mousedown"+h+" keydown"+h+" ",function(t){if("mousedown"!==t.type||!p){if(u=!1,"touchstart"===t.type&&1===t.originalEvent.touches.length){var e=t.originalEvent.touches[0];s=e.pageX,r=e.pageY,c=!0,o=setTimeout(d.bind(void 0,t,"touch",!0),l),n._contextMenuPressHoldTimer=o}return!0}}).on("touchmove"+h,function(t){var e=t.originalEvent.touches[0];return(Math.abs(s-e.pageX)>5||Math.abs(r-e.pageY)>5)&&(c=!1,clearTimeout(o)),!0}).on("touchend"+h+" touchcancel"+h,function(t){return c=!1,clearTimeout(o),!0}).on("keydown"+h+" contextmenu"+h,function(t){if("contextmenu"===t.type||121==t.which&&t.shiftKey){var e=c?"touch":"keydown"===t.type?"keyboard":"mouse";d(t,e,!1)}return!0}),t.DomUtils.isTouchSupported()&&e(n).addClass("oj-menu-context-menu-launcher")},e(document).ready(function(){var t,n;(n=e("
")).appendTo("body"),t=n.css("backgroundImage"),n.css("borderTopColor")!=n.css("borderRightColor")&&(null==t||"none"!=t&&"url (invalid-url:)"!=t)||e("body").addClass("oj-hicontrast"),n.remove()}),t.Test={},t.Test.ready=!1,t.Test.domNodeForLocator=function(n){var i=n;if(t.StringUtils.isString(n)){var o=n;try{i=JSON.parse(o)}catch(t){return null}}if(i&&i.element){var s=e(i.element);if(s){delete i.element;var r=i;return t.Components.getNodeBySubId(s[0],r)}}return null},t.Test.getOpenPopupCount=function(){return t.ZOrderUtils.getOpenPopupCount()},t.Test.findOpenPopups=function(){return t.ZOrderUtils.findOpenPopups()},t.Test.compareStackingContexts=function(e,n){return t.ZOrderUtils.compareStackingContexts(e,n)},e.cleanData=(N=e.cleanData,function(e){var n,i,o=[];for(n=0;null!=(i=e[n]);n++){var s=!1,r=t.Components.__GetWidgetConstructor(i);if(r&&!(s=r("instance")._IsCustomElement())){var a=t.Components.getComponentElementByNode(i);s=a&&t.BaseCustomElementBridge.getRegistered(a.tagName)}s||o.push(i)}o.length>0&&N(o)}),t.CustomElementBridge.registerMetadata("baseComponent",null,{extension:{_WIDGET_NAME:"baseComponent"}})});